package com.exam.service.impl;

import com.exam.dao.TLogDao;
import com.github.pagehelper.PageHelper;
import com.exam.common.ServResult;
import com.exam.common.SnowflakeId;
import com.exam.dao.TArticleDao;
import com.exam.service.TArticleService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.omg.CORBA.CODESET_INCOMPATIBLE;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@Service("tArticleService")
public class TArticleServiceImpl implements TArticleService {


    @Autowired
    private TArticleDao tArticleDao;

    @Autowired
    private TLogDao tLogDao;
    @Override
    public ServResult findListByPage(Map<String, Object> param, Integer current, Integer size) {
//        ServResult result = null;
//        try {
////            String articleLabel = (String) param.get("articleLabel");
////            int totalSize = tArticleDao.findAllCount(param);
////            PageHelper.startPage(current, size);
////            List<Map<String, Object>> data = tArticleDao.findAll(param);
////            int pages = totalSize % size == 0 ? totalSize / size : (totalSize / size + 1);
////            result = ServResult.success("查询数据成功！", data, totalSize, pages);
//        } catch (Exception e) {
//            e.printStackTrace();
//            result = ServResult.fail();
//        }
//        return result;
        return ServResult.success();
    }

    @Override
    public String dual() {
        return tArticleDao.findAll();
    }

}
